package com.hengxinguotong.hxgtwygsp.ui.imgView;

import android.os.Bundle;
import android.widget.ImageView;

import com.hengxinguotong.hxgtwygsp.R;
import com.hengxinguotong.hxgtwygsp.ui.base.BaseTabFragment;

import javax.inject.Inject;

import butterknife.BindView;

/**
 * 填充图片的Fragment
 * Created by CS-Yong
 * 2019/8/30  14:56
 */
public class ImgViewFragment extends BaseTabFragment {
    @BindView(R.id.iv_fill_img)
    ImageView mIvFillImg;

    private int mImgName;

    @Inject
    public ImgViewFragment() {
    }

    @Override
    public int getLayoutResId() {
        return R.layout.fragment_img_view;
    }

    @Override
    public void init() {
        Bundle bundle = getArguments();
        //这里就拿到了之前传递的参数
        mImgName = bundle.getInt("imgName");

        mIvFillImg.setImageResource(mImgName);
    }

    public static ImgViewFragment getInstance(int imgName){
        ImgViewFragment imgViewFragment = new ImgViewFragment();
        Bundle bundle = new Bundle();
        bundle.putInt("imgName", imgName);
        imgViewFragment.setArguments(bundle);
        return  imgViewFragment;
    }


}
